From: Debian Science Team Date: Wed, 26 Aug 2020 21:34:50 +0000 (+0100) Subject: Don't use 'is' with literals X-Git-Tag: archive/raspbian/1.0.5+dfsg-3+rpi1^2~11 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b66b766fbdaa78be0c28ee49bd1e9f798ef1e790;p=pandas.git Don't use 'is' with literals It causes a SyntaxWarning on install, and possibly undefined test results Author: Rebecca N. Palmer Bug-Debian: https://bugs.debian.org/956021 Forwarded: https://github.com/pandas-dev/pandas/pull/33322 Gbp-Pq: Name fix_is_warnings.patch --- diff --git a/pandas/tests/frame/test_alter_axes.py b/pandas/tests/frame/test_alter_axes.py index 602ea9ca..2a94cf8e 100644 --- a/pandas/tests/frame/test_alter_axes.py +++ b/pandas/tests/frame/test_alter_axes.py @@ -236,9 +236,16 @@ class TestDataFrameAlterAxes: # need to adapt first drop for case that both keys are 'A' -- # cannot drop the same column twice; - # use "is" because == would give ambiguous Boolean error for containers + # plain == would give ambiguous Boolean error for containers first_drop = ( - False if (keys[0] is "A" and keys[1] is "A") else drop # noqa: F632 + False + if ( + type(keys[0]) == str + and keys[0] == "A" + and type(keys[1]) == str + and keys[1] == "A" + ) + else drop ) # to test against already-tested behaviour, we add sequentially, # hence second append always True; must wrap keys in list, otherwise